public class Overload {
    public static void main(String[] args) {
        MyCalculator mc = new MyCalculator();
        System.out.println(mc.calculator(1,2));
        System.out.println(mc.calculator(1.1,2));
        System.out.println(mc.calculator(1,2.1));
        System.out.println(mc.calculator(1,2,3));
    }
}

class MyCalculator{
    // 方法重载: 1.方法名必须相同
    // 2. 参数列表必须不同 （参数类型或个数或吮吸，至少有一样不同）
    // 3.返回类型无要求
    public int calculator(int n1,int n2){
        return n1 + n2;
    }

    public double calculator(int n1,double n2){
        return n1 + n2;
    }

    public double calculator(double n1,int n2){
        return n1 + n2;
    }

    public double calculator(int n1,int n2,int n3){
        return n1 + n2 + n3;
    }
}
